import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _isString from "lodash/isString";
import _isBoolean from "lodash/isBoolean";

/**
 * FieldValueList.js
 * @date 2018/11/14
 */
import React from 'react';
import { Form, Input, Checkbox } from 'antd';
// import intl from 'utils/intl';
import { attributeNameProp, attributeTypeProp, attributeValueProp } from "../../config";
import DataType from "../../DataType";
var booleanCheckProps = {
  checkedValue: true,
  unCheckedValue: false
};

var FieldValueList = /*#__PURE__*/function (_React$Component) {
  _inherits(FieldValueList, _React$Component);

  var _super = _createSuper(FieldValueList);

  function FieldValueList() {
    _classCallCheck(this, FieldValueList);

    return _super.apply(this, arguments);
  }

  _createClass(FieldValueList, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          form = _this$props.form,
          _this$props$propValue = _this$props.propValues,
          propValues = _this$props$propValue === void 0 ? {} : _this$props$propValue;
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
        key: "lazyLoad"
      }, form.getFieldDecorator('lazyLoad', {
        initialValue: propValues.lazyLoad !== false
      })( /*#__PURE__*/React.createElement(Checkbox, booleanCheckProps, "\u61D2\u52A0\u8F7D"))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "lovCode",
        label: "\u503C\u96C6\u7F16\u7801"
      }, form.getFieldDecorator('lovCode', {
        initialValue: propValues.lovCode
      })(React.createElement(Input, {}, undefined))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "queryUrl",
        label: "\u52A0\u8F7DURL"
      }, form.getFieldDecorator('queryUrl', {
        initialValue: propValues.queryUrl
      })(React.createElement(Input))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "valueField",
        label: "\u503C\u5B57\u6BB5"
      }, form.getFieldDecorator('valueField', {
        initialValue: propValues.valueField
      })( /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "displayField",
        label: "\u663E\u793A\u5B57\u6BB5"
      }, form.getFieldDecorator('displayField', {
        initialValue: propValues.displayField
      })( /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "textField",
        label: "\u663E\u793A\u503C\u5B57\u6BB5"
      }, form.getFieldDecorator('textField', {
        initialValue: propValues.textField
      })(React.createElement(Input))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "cascadeFlag",
        className: "ant-form-item-checkbox-cascade-parent"
      }, form.getFieldDecorator('cascadeFlag', {
        initialValue: propValues.cascadeFlag
      })( /*#__PURE__*/React.createElement(Checkbox, booleanCheckProps, "\u7EA7\u8054"))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "cascadeFrom",
        label: "\u7EA7\u8054\u5B57\u6BB5",
        className: "ant-form-item-checkbox-cascade-child"
      }, form.getFieldDecorator('cascadeFrom', {
        initialValue: propValues.cascadeFrom,
        rules: [// { required: true, message: '级联字段不能为空' },
        ]
      })( /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "cascadeField",
        label: "\u7EA7\u8054\u6620\u5C04\u53C2\u6570"
      }, form.getFieldDecorator('cascadeField', {
        initialValue: propValues.cascadeField,
        rules: [// { required: true, message: '级联映射参数' },
        ]
      })( /*#__PURE__*/React.createElement(Input, null))));
    }
  }]);

  return FieldValueList;
}(React.Component);

export { FieldValueList as default };
export function getConfigOfPropValues(propValues) {
  var newConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

  if (_isString(propValues.lovCode)) {
    var _newConfig$push;

    newConfig.push((_newConfig$push = {}, _defineProperty(_newConfig$push, attributeNameProp, 'lovCode'), _defineProperty(_newConfig$push, attributeValueProp, propValues.lovCode), _defineProperty(_newConfig$push, attributeTypeProp, DataType.String), _newConfig$push));
  }

  if (_isString(propValues.queryUrl)) {
    var _newConfig$push2;

    newConfig.push((_newConfig$push2 = {}, _defineProperty(_newConfig$push2, attributeNameProp, 'queryUrl'), _defineProperty(_newConfig$push2, attributeValueProp, propValues.queryUrl), _defineProperty(_newConfig$push2, attributeTypeProp, DataType.String), _newConfig$push2));
  }

  if (_isBoolean(propValues.lazyLoad)) {
    var _newConfig$push3;

    newConfig.push((_newConfig$push3 = {}, _defineProperty(_newConfig$push3, attributeNameProp, 'lazyLoad'), _defineProperty(_newConfig$push3, attributeValueProp, propValues.lazyLoad), _defineProperty(_newConfig$push3, attributeTypeProp, DataType.Boolean), _newConfig$push3));
  }

  if (_isString(propValues.valueField)) {
    var _newConfig$push4;

    newConfig.push((_newConfig$push4 = {}, _defineProperty(_newConfig$push4, attributeNameProp, 'valueField'), _defineProperty(_newConfig$push4, attributeValueProp, propValues.valueField), _defineProperty(_newConfig$push4, attributeTypeProp, DataType.String), _newConfig$push4));
  }

  if (_isString(propValues.displayField)) {
    var _newConfig$push5;

    newConfig.push((_newConfig$push5 = {}, _defineProperty(_newConfig$push5, attributeNameProp, 'displayField'), _defineProperty(_newConfig$push5, attributeValueProp, propValues.displayField), _defineProperty(_newConfig$push5, attributeTypeProp, DataType.String), _newConfig$push5));
  }

  if (_isString(propValues.textField)) {
    var _newConfig$push6;

    newConfig.push((_newConfig$push6 = {}, _defineProperty(_newConfig$push6, attributeNameProp, 'textField'), _defineProperty(_newConfig$push6, attributeValueProp, propValues.textField), _defineProperty(_newConfig$push6, attributeTypeProp, DataType.String), _newConfig$push6));
  }

  if (_isBoolean(propValues.cascadeFlag)) {
    var _newConfig$push7;

    newConfig.push((_newConfig$push7 = {}, _defineProperty(_newConfig$push7, attributeNameProp, 'cascadeFlag'), _defineProperty(_newConfig$push7, attributeValueProp, propValues.cascadeFlag), _defineProperty(_newConfig$push7, attributeTypeProp, DataType.Boolean), _newConfig$push7));
  }

  if (_isString(propValues.cascadeFrom)) {
    var _newConfig$push8;

    newConfig.push((_newConfig$push8 = {}, _defineProperty(_newConfig$push8, attributeNameProp, 'cascadeFrom'), _defineProperty(_newConfig$push8, attributeValueProp, propValues.cascadeFrom), _defineProperty(_newConfig$push8, attributeTypeProp, DataType.String), _newConfig$push8));
  }

  if (_isString(propValues.cascadeField)) {
    var _newConfig$push9;

    newConfig.push((_newConfig$push9 = {}, _defineProperty(_newConfig$push9, attributeNameProp, 'cascadeField'), _defineProperty(_newConfig$push9, attributeValueProp, propValues.cascadeField), _defineProperty(_newConfig$push9, attributeTypeProp, DataType.String), _newConfig$push9));
  }

  return newConfig;
}
export var lifeUpgrade = [];
FieldValueList.getConfigOfPropValues = getConfigOfPropValues;
FieldValueList.lifeUpgrade = lifeUpgrade;